<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
        }
        .dbox{
            background-color: blue;
        }
    
    </style>
</head>
<body>
    <div class="box abox" id="elebox" draggable="true"></div>
    <script>
    
    console.log(document.querySelector('.box'))
    console.log(document.querySelectorAll('.box'))
    var ele = document.querySelector('.box');
    console.log(ele.tagName)
    console.log(ele.className)   
    console.log(ele.draggable);
    console.log(ele.hidden);
    console.log(ele.attributes);
    //class
    var eleClass = ele.classList;
    eleClass.add('cbox');
    eleClass.remove('abox');
    //判断是否存在
    console.log(eleClass.contains('box'));
    ele.onclick = function(){
        eleClass.toggle('dbox');
    }
    console.log(eleClass);
    console.log(ele.className)
    ele.className+= ' ubox';
    //window document
    var name = 1;
    console.log(window.name)
    </script>
</body>
</html>